# 用例API-002
#测试步骤： 使用工具发送 列出客户的API请求, 请求消息头cookie中没有携带登录成功的sessionid
# 预期结果：服务器返回结果为 HTTP/1.1 302
# Content-Type：application/json

# {
#     "ret" : 302,
#     "msg" : "未登录",
#     "redirect" : "/msg/sign.html"
# }
import requests


def printResponse(response):
    print("\n************************************ 服务端返回结果为 :  ******************************************\n")
    print(response.status_code)

    for k,v in response.headers.items():
        if k.lower() == "content-type":
          print(f"{k} : {v}")
        else: continue
    print("")

    print(response.content.decode("utf-8"))
    print("\n***********************************************************************************************\n")


session = requests.Session()
response = session.get("http://127.0.0.1/api/mgr/customers?action=list_customer&pagenum=1&pagesize=5&keywords=&_=1759045677973")

printResponse(response)